const initState = {
  screenValue: '0',
  errorTip: ''
}
export default function calculatorReducer(preState = initState, action)  {
  const { type, value } = action;
  switch (type) {
    case 'updateScreenValue':
      return {...preState, screenValue: value};
    case 'reset':
      return initState;
    case 'updateErrorTip':
      return {...preState, errorTip: value};
    default:
      return preState;
  }
}